package factory

import java.util.function.Function

import dto.req.{CloseOrderReqDTO, NotifyReqDTO, PayOrderReqDTO, QueryOrderReqDTO, RefundOrderReqDTO}
import dto.resp.{CloseOrderRespDTO, PayOrderRespDTO, QueryOrderRespDTO, RefundOrderRespDTO}

trait BaseAction {

  @throws[Exception]
  def buildOrder[T <: PayOrderReqDTO, R >: PayOrderRespDTO](req: T): R

  def payTransaction[T <: PayOrderReqDTO, R >: PayOrderRespDTO](function: Function[T, R], req: T): R

  def pay[T <: PayOrderReqDTO](req: T): Unit

  @throws[Exception]
  def closeOrder[T <: CloseOrderReqDTO, R >: CloseOrderRespDTO](req: T): R

  def callback[T <: NotifyReqDTO](req: T): Boolean

  @throws[Exception]
  def query[T <: QueryOrderReqDTO, R <: QueryOrderRespDTO](req: T, resp: R): R

  @throws[Exception]
  def refundQuery[T <: QueryOrderReqDTO, R <: QueryOrderRespDTO](req: T, resp: R): R

  def refundTransaction[T <: RefundOrderReqDTO](req: T): Unit

  def refundFailTransaction[T <: RefundOrderReqDTO](req: T): Unit

  @throws[Exception]
  def refund[T <: RefundOrderReqDTO, R >: RefundOrderRespDTO](req: T): R

  def setProperties(bizCode: String): Unit

  def getPayChannel: Integer
}
